﻿@model KPIS.GERP.Models.ICM.File

@Html.HiddenFor(model => model.FileId)
@Html.HiddenFor(model => model.RecordStatus)

@if(Model != null)
{ 
        <div class="widget-box span12">
            <div class="widget-header">
				<h5 class="smaller">เอกสารแนบ</h5>

				<div class="widget-toolbar no-border">
					<ul class="nav nav-tabs" id="myTab">
						<li class="active">
							<a data-toggle="tab" href="#detail">รายละเอียด</a>
						</li>
                        @if((Model.FileType??string.Empty).ToLower().Contains("image"))
                        {
						    <li>
							    <a data-toggle="tab" href="#sample">ตัวอย่าง</a>
						    </li>
                        }
					</ul>
				</div>
			</div>

            <div class="widget-body" >
                <div class="tab-content">
                    <div class="widget-main form-horizontal tab-pane in active" id="detail"> 
                        <div class="control-group">
                            <div class="control-label">
                                @Html.DisplayNameFor(model => model.FileName)
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                @*@Html.ActionLink(model => model.FileName)*@
                                <a href="@Url.Action("StreamFileFromDisk4", new{Id = Model.FileId})" title="ดาวน์โหลดไฟล์">
                                    <strong>@Model.FileName</strong> &nbsp;&nbsp;
                                    <i class="icon-download-alt bigger-120"></i>
                                </a>
                        
                                @*<a href="/File/GetFileFromDisk1/@Model.FileId" style="color:red;padding-left:1em;">Click1</a>
                        <a href="/File/GetFileFromDisk2/@Model.FileId" style="color:red;padding-left:1em;">Click2</a>
                        <a href="/File/GetFileFromDisk3/@Model.FileId" style="color:red;padding-left:1em;">Click3</a>
                        <a href="/File/StreamFileFromDisk4/@Model.FileId" style="color:red;padding-left:1em;">Click4</a>
                        <a href="/File/StreamFileFromDisk5/@Model.FileId" style="color:red;padding-left:1em;">Click5</a>
                        <a href="/File/StreamFileFromDisk6/@Model.FileId" style="color:red;padding-left:1em;">Click6</a>
                        <a href="/File/StreamFileFromDisk7/@Model.FileId" style="color:red;padding-left:1em;">Click7</a>
                        <a href="/File/StreamFileFromDisk8/@Model.FileId" style="color:red;padding-left:1em;">Click8</a>
                        <a href="/File/StreamFileFromDisk9/@Model.FileId" style="color:red;padding-left:1em;">Click9</a>
                        @{
                                @Html.Raw("<br>")
                                @Html.DisplayName(Server.MapPath("~/App_Data/uploads/"))
                                @Html.Raw("<br>")
                                @Html.DisplayName(AppDomain.CurrentDomain.BaseDirectory+"/App_Data/uploads/")
                            }
                        @*<a href="/File/StreamFileFromDisk">Click to get file</a>*@
                            </div>
                        </div>
                
                        <div class="control-group">
                            <div class="control-label">
                                @Html.DisplayNameFor(model => model.FileDescription)
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                @Model.FileDescription
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="control-label">
                                @Html.DisplayNameFor(model => model.FileDownloadCount)
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                @Model.FileDownloadCount
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="control-label">
                                @Html.DisplayNameFor(model => model.FileSizeByte)
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                @KPIS.GERP.Models.Class.FileUtility.GetFileSizeHumanReadable(Model.FileSizeByte)
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="control-label">
                                @Html.DisplayNameFor(model => model.FileDescription)
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                @Model.FileDescription
                            </div>
                        </div>
                        @*<div class="control-group">
                    <div class="control-label">
                         @Html.DisplayNameFor(model => model.FilePath)
                    </div>
                    <div class="controls-detail" style="margin-top:5px !important;">
                        @Html.DisplayFor(model => model.FilePath)
                    </div>
                </div>*@
                        <div class="control-group">
                            <div class="control-label">
                                @Html.DisplayNameFor(model => model.FileExtention)
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                @Html.DisplayFor(model => model.FileExtention)
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="control-label">
                                @Html.DisplayName("ขั้นตอนที่เพิ่มเอกสารแนบ")
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                @Html.DisplayFor(model => model.SysProcess.LookUpName)
                                @Html.Raw("*&nbsp*&nbspRef Id:")
                                @Html.DisplayFor(model => model.RefId)
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="control-label">
                                @Html.DisplayNameFor(model => model.CreatedWhen)
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                @Html.DisplayFor(model => model.CreatedWhen, "DateWithTime")
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="control-label">
                                &nbsp;
                            </div>
                            <div class="controls-detail" style="margin-top:5px !important;">
                                <a class="btn btn-info" role="button" href="@Url.Action("StreamFileFromDisk4", new{Id = Model.FileId})" title="ดาวน์โหลดไฟล์">
                                    ดาวน์โหลดไฟล์
                                    <i class="icon-download-alt bigger-120 icon-on-right"></i>
                                </a>
                            </div>
                        </div>
                    </div>
                
                    <div id="sample"class="tab-pane center">
                        
                        <a   href="@Url.Action("StreamFileFromDisk4", new{Id = Model.FileId})" title="ดาวน์โหลดไฟล์">
                            <img src="@Url.Action("StreamFileFromDisk4", "File", new {id = Model.FileId, dontCountAsLoaded = true })" width="80%" alt=""/>
                        </a> 
                    </div>


                </div>
            </div>
            
             
        </div> 
     
}
